<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:92:"/Users/doyi/project/east_environmental/public/../application/index/view/index/news_list.html";i:1547393543;s:78:"/Users/doyi/project/east_environmental/application/index/view/common/menu.html";i:1547309183;s:80:"/Users/doyi/project/east_environmental/application/index/view/common/footer.html";i:1546681093;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?php echo (isset($title_name ) && ($title_name  !== '')?$title_name :'首页'); ?></title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <script src="/index/js/jquery-1.9.1.min.js"></script>
    <script src="/index/js/layer.js"></script>
    <!---->
    <link rel="stylesheet" href="/index/libs/swiper3/css/swiper.min.css">
    <link rel="stylesheet" href="/index/libs/layui/css/layui.css">
    <link rel="stylesheet" href="/index/css/common.css">
    <!---->
    <script src="/index/libs/swiper3/js/swiper.min.js"></script>
    <script src="/index/libs/layui/layui.js"></script>


    <script src="/index/js/common.js"></script>
    <!--<script src="/index/js/index.js"></script>-->
    <link rel="stylesheet" href="/index/css/news-list.css">
    <!---->
</head>
<body>
<div class="wrap">
    <header>
            <div class="nav wrap-w clearfix">
        <div class="fl nav-left">
            <a href="<?php echo url('index/index'); ?>" class="logo">
                <img src="/index/images/logo_04.png" alt="">
            </a>
            <a href="javascript:void(0)" class="city-select">
                <dl>
                    <dt>
                        <em class="city">全国</em><img src="/index/images/logo_06.png" alt="">
                    </dt>
                    <dd class="clearfix">
                        <p class="active"><span>全国</span></p>
                        <?php foreach($province as $k=>$v): ?>
                        <p><span><?php echo $v['province']; ?></span></p>
                        <?php endforeach; ?>
                    </dd>
                </dl>

            </a>
            <a href="<?php echo url('index/index'); ?>" <?php if((isset($active))): if(($active == 1)): ?>class="active" <?php endif; endif; ?>>首页</a>
            <a href="<?php echo url('index/news_list',['type'=>1]); ?>" <?php if((isset($active))): if(($active == 3)): ?>class="active" <?php endif; endif; ?>>新闻中心</a>
            <a href="<?php echo url('index/activity'); ?>" <?php if((isset($active))): if(($active == 4)): ?>class="active" <?php endif; endif; ?>>促销活动</a>
            <a href="<?php echo url('index/public_info'); ?>" <?php if((isset($active))): if(($active == 2)): ?>class="active" <?php endif; endif; ?>>信息公开</a>
        </div>
        <div class="fr nav-right clearfix">
            <dl class="user">
                <dt>欢迎您！
                    <?php if((isset($user))): if((isset($user['realname']) && !empty($user['realname']))): ?>
                              <?php echo $user['user_name']; else: ?>
                    &nbsp;&nbsp;        <?php echo $user['user_name']; endif; else: ?>
                    <a href="<?php echo url('login/login'); ?>">登录</a>/<a href="<?php echo url('login/register'); ?>">注册</a>
                    <?php endif; ?>
                </dt>
                <?php if((isset($user))): ?>
                <div class="dd">
                    <dd>
                        <a href="<?php echo url('user/index',['type'=>2]); ?>"><img class="img-origin" src="/index/list0.png" alt=""><img class="img-active" src="/index/list1.png" alt="">我的订单</a>
                    </dd>
                    <!--<dd>-->
                        <!--<a href=""><img class="img-origin" src="/index/msg0.png" alt=""><img class="img-active" src="/index/msg1.png" alt="">我的邮件</a>-->
                    <!--</dd>-->
                    <dd>
                        <a href="<?php echo url('user/index'); ?>"><img class="img-origin" src="/index/set0.png" alt=""><img class="img-active" src="/index/set1.png" alt="">个人中心</a>
                    </dd>
                    <dd>
                        <a href="<?php echo url('login/login_out'); ?>"><img class="img-origin" src="/index/out1.png" alt=""><img class="img-active" src="/index/out0.png" alt="">退出登录</a>
                    </dd>
                </div>
                <?php endif; ?>
            </dl>
            <dl class="messages">
                <a href="<?php echo url('user/index',['type'=>3]); ?>"> <dt><img src="/index/images/img_06.png" alt=""></dt></a>
                <!--<div class="dd">-->
                    <!--<?php foreach($notice as $k=>$v): ?>-->

                    <!--<dd>-->
                        <!--<a href="">-->
                                <!--<?php if(($v['type'] == 1 )): ?>-->
                                <!--<span class="blue">【通知】</span>-->
                                <!--<?php endif; ?>-->
                                 <!--<?php if(($v['type'] == 2 )): ?>-->
                                <!--<span class="green">【公告】</span>-->
                                <!--<?php endif; ?>-->
                                 <!--<?php echo $v['system_title']; ?>-->
                                <!--<?php if(($k < 3)): ?>-->
                                 <!--<span class="dots"></span>-->
                                <!--<?php endif; ?>-->
                        <!--</a>-->
                    <!--</dd>-->
                    <!--<?php endforeach; ?>-->
                    <!--<dd class="more">-->
                        <!--<a href="">查看更多 ></a>-->
                    <!--</dd>-->
                <!--</div>-->

            </dl>
            <dl class="notice">
                <dt><img src="/index/images/img_72_06_03.png" alt=""><span>关注我们</span></dt>
                <div class="dd clearfix">
                    <h1>扫一扫关注我们</h1>
                    <dd class="fl">
                        <img src="/index/images/img_61.png" alt="">
                        <p>微信公众号“9999”</p>

                    </dd>
                    <dd class="fr">
                        <img src="/index/images/img_05.jpg" alt="">
                        <p>新浪微博“东方环保”</p>
                    </dd>

                </div>


            </dl>
        </div>
    </div>



        <div class="banner">
            <a href="">
                <img src="/index/images/sale_02.png" alt="">
            </a>
        </div>
    </header>
    <div class="container container-register">
        <div class="wrap-w">
            <div class="register-header clearfix">
                <div class="labels fl">
                   排序：<span  class="newest  active" >最新</span>
                    <span  class="hotest ">最热</span>
                </div>
                <div class="fr">
                    <div class="search">
                        <input type="hidden" id="type" value="<?php echo (isset($type ) && ($type  !== '')?$type :''); ?>">
                        <input type="text" placeholder="请输入关键字" id="title" value="<?php echo (isset($content ) && ($content  !== '')?$content :''); ?>">
                        <span class="search_title" style="cursor:pointer">搜索</span>
                    </div>
                </div>
            </div>
            <div class="news-content clearfix">
                <div id="news-content">

                </div>

                <div class="pagnation" id="pagnation">

                </div>
        </div>


                <!--<div class="pagnation">-->
                    <!--<span class="current">1</span>-->
                    <!--<span>2</span>-->
                    <!--<span>3</span>-->
                    <!--<span>4</span>-->
                    <!--<span>5</span>-->
                    <!--<span>...</span>-->
                    <!--<span>></span>-->
                    <!--<em>共100页，到第 <input type="text" value="12"> 页</em>-->
                    <!--<span class="sure">确定</span>-->
                <!--</div>-->

        </div>
        </div>
    </div>
    <footer>
    <div class="footer-menu">

        <div class="wrap-w clearfix">
            <dl>
                <dt>
                    我们的服务
                </dt>
                <dd><a href="">线下服务</a></dd>
                <dd><a href="">订单系统</a></dd>
            </dl>
            <dl>
                <dt>
                    关于我们
                </dt>
                <dd><a href="">公司介绍</a></dd>
                <dd><a href="">团队介绍</a></dd>
                <dd><a href="">联系方式</a></dd>
            </dl>
            <dl>
                <div class="erwei fl">
                    <img src="/index/images/img_61.png" alt="">
                    <p>官方微信</p>
                </div>
                <div class="fl">
                    <dt>
                        联系我们
                    </dt>
                    <dd class="footer-phone"><a href=""><img src="/index/images/phone_03.png" alt="">400-222-8888</a></dd>
                    <dd><a href="javascript:void(0);">地址：福建省晋江市安东开发区</a></dd>
                </div>
            </dl>
            <!--<dl>-->
            <!--<dt>-->
            <!--联系我们-->
            <!--</dt>-->
            <!--<dd><a href=""><img src="/index/images/phone_03.png" alt="">400-222-8888</a></dd>-->
            <!--<dd><a href="javascript:void(0);">地址：福建省晋江市安东开发区</a></dd>-->
            <!--</dl>-->
        </div>
    </div>
    <p class="foot">Copyright©2015-2018，版权所有 东方环保 </p>
</footer>
</div>


<script>
    var articleEle = '';
    //layui模块
    layui.use(['form', 'layedit', 'laydate','laypage'], function() {
        var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate
                , laypage = layui.laypage;


        var articleCount = window.localStorage.getItem('articleCount');
        laypage.render({
            elem: 'pagnation'
            ,count: articleCount
//            ,layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            ,layout: [ 'prev','page','next','count', 'skip']
            ,limit:5
            ,prev: '<em><</em>'
            ,next: '<em>></em>'
            ,jump: function(obj){
                console.log(obj);
                var pageSize = obj.limit;
                var pageNo = obj.curr;
                var _index = $('.register-header .labels span.active').index()+1;
                $('#news-content').html('');
                articleAjax(pageSize,pageNo,_index,$('#title').val(),1);
            }
        });


        $('.register-header .labels span').on('click',function () {
            $(this).addClass('active').siblings().removeClass('active');
            var _index = $(this).index()+1;
            $('#news-content').html('');
            articleAjax(5,1,_index,$('#title').val(),1);
        })
        $('.search_title').on('click',function () {
            var _index = $('.register-header .labels span.active').index()+1;
            $('#news-content').html('');
            articleAjax(5,1,_index,$('#title').val(),1);
        })

        form.render();


    })


    //订单方法
    function articleAjax(pageSize,pageNo,type,content,newsType) {
        articleEle='';

        //渲染列表
        $.ajax({
            type: "POST",
            dataType: 'json',
            url: '/index/index/news_page_list',
            data:{
                type:type,
                news_type:newsType,
                content:content,
                pageSize:pageSize,
                pageNo:pageNo
            },
            success: function (data) {
                if (data.code == 200) {
                    if (data.data.data.length != 0 && data.data.data != null) {
                        $('.null').hide();

                        var result = data.data.data;
                        window.localStorage.setItem('articleCount',data.data.count);
                        for (var i = 0; i < data.data.data.length; i++) {
                            articleFrame(result[i]);
                            $('.pagnation').show();
                        }


                    }else{
                        $('.null').show();

                    }
                }

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
            },
            complete: function () {

            }
        });

    }
    /*订单数据结构*/
    function articleFrame(result) {
        //订单html模板
               articleEle += '<div class="items">'
        articleEle +='<a href="/index/index/news_info?id='+result.id+'">'
        articleEle +='<div class="img fl" style="background-image: url('+result.title_img+')"></div>'
        articleEle +='<div class="content fl">'
        articleEle +='<h1>'+result.title+'</h1>'
        articleEle +='<p class="des">'+result.content+'</p>'
        articleEle +='<p class="time">发布时间：'+result.add_time+'<span class="times">浏览次数：'+result.view_count+'次</span></p>'
        articleEle += '</div>'
        articleEle +='</a>'

        articleEle +='</div>';


        $('#news-content').html(articleEle);
    }

    $(function () {
        window.localStorage.clear();
    })
</script>

